## config.py
import os
# No imports are necessary for this configuration file

from typing import Dict, Any

# ================ES配置===================
# Configuration for Elasticsearch
ELASTICSEARCH_HOST: str = "http://193.112.112.223:9200"
ELASTICSEARCH_KNOWLEDGE_BASE_INDEX: str = "private_knowledge_base"
ELASTICSEARCH_CHAT_HISTORY_INDEX: str = "chat_history"
ELASTICSEARCH_USER = "elastic"
ELASTICSEARCH_PASSWORD = "9yC56qA+29y06J0HE9uw"
# Default settings for Elasticsearch indices
ELASTICSEARCH_DEFAULT_SETTINGS: Dict[str, Any] = {
    "number_of_shards": 1,
    "number_of_replicas": 0
}

# Mappings for Elasticsearch indices
ELASTICSEARCH_KNOWLEDGE_BASE_MAPPINGS: Dict[str, Any] = {
    "properties": {
        "entry_id": {"type": "keyword"},
        "content": {"type": "text", "analyzer": "ik_max_word"}
    }
}

ELASTICSEARCH_CHAT_HISTORY_MAPPINGS: Dict[str, Any] = {
    "properties": {
        "user_id": {"type": "keyword"},
        "bot_id": {"type": "keyword"},
        "message": {"type": "text", "analyzer": "ik_max_word"},
        "response": {"type": "text", "analyzer": "ik_max_word"},
        "conversation_id": {"type": "keyword"},
        "tags": {"type": "keyword"}
    }
}

# ===============Neo4j配置==================
NEO4J_HOST: str = "bolt://193.112.112.223:7687"
NEO4J_BROWSER: str = "http://193.112.112.223:7474"
NEO4J_USER: str = "neo4j"
NEO4J_PASSWORD: str = "cyh121598"
NEO4J_DB: str = "neo4j"

# ===============文本2图谱配置===================
DIFFBOT_API_KEY = "f02239b920d71f46ba2b6c0bec90e20c"

# ==================必应搜索=======================
CUSTOM_CONFIGURATION_ID = "aec18866-c9dc-48dc-b98c-bfc78719b6c5"
BING_SUBSCRIPTION_KEY = "1939505f7694484288edecda2318dde0"
BING_SEARCH_URL = "https://api.bing.microsoft.com/v7.0/search"
os.environ["BING_SUBSCRIPTION_KEY"] = BING_SUBSCRIPTION_KEY

# # ==================DeepSeek配置====================
# OPENAI_API_KEY: str = "sk-cd9afa41c83944ddb332a1e6de81f460"
# OPEN_API_BASE: str = "https://api.deepseek.com"
# OPEN_MODULE_NAME: str = "deepseek-chat"
# ================阿里云模型配置====================
# Configuration for OpenAI
OPENAI_API_KEY: str = "sk-48f87ac0b33a4e95b6cefddd72bce11e"
OPEN_API_BASE: str = "https://dashscope.aliyuncs.com/compatible-mode/v1"
# OPEN_MODULE_NAME: str = "qwen-72b-chat"
OPEN_MODULE_NAME: str = "qwen2.5-7b-instruct"
IMAGE_MODULE_NAME: str = "wanx2.1-t2i-turbo"
PROMPT2IMAGE_MODULE_NAME = "wanx-sketch-to-image-lite"
IMAGE2_NEW_IMAGE_MODULE_NAME = "wanx-x-painting"

# =================LangSmith配置=========================
# LANGSMITH_API_KEY= "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"
LANGSMITH_API_KEY= "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"
##临时设置环境变量
###LANGCHAIN_TRACING_V2是设置LangChain是否开启日志跟踪模式。
os.environ['LANGCHAIN_TRACING_V2']="true"
###LANGCHAIN_API_KEY就是上面生成的LangSmith的key。
os.environ['LANGCHAIN_API_KEY']=LANGSMITH_API_KEY
os.environ['LANGCHAIN_ENDPOINT']="https://api.smith.langchain.com"
###LANGCHAIN_PROJECT 是要跟踪的项目名称，如果LangSmith平台上还没有这个项目，会自动创建。如果不设置这个环境变量，会把相关信息写到default项目。这里的项目不一定要跟你实际的项目一一对应，可以理解为分类或者标签。你只要在运行某个应用前改变这一项，就会把相关的日志写到这个下面。
###可以按开发、生产环境分，也可以按日期分等等。
os.environ['LANGCHAIN_PROJECT']="pr-prickly-someplace-27"


# OPENAI_API_KEY = "bfe2acf258a744aeaa79b71e8c905386"
# OPEN_API_BASE = "http://10.0.101.250:7996/v1"
# OPEN_MODULE_NAME = "Qwen2-72B-Instruct-feisuan"

# =======大模型配置
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
os.environ["OPENAI_API_BASE"] = OPEN_API_BASE

# Default language settings
DEFAULT_LANGUAGE: str = "chinese"
SUPPORTED_LANGUAGES: Dict[str, str] = {
    "chinese": "ik_max_word",
    "english": "standard"
}

# Other configurations
APP_PORT: int = 5000
APP_HOST: str = "0.0.0.0"
